<?php

namespace api\modules\v1\controllers;

use yii;

class DefaultController extends yii\web\Controller
{
    public $enableCsrfValidation = false;
    /**
     * 接口列表
     * @return array
     */
    public function actionIndex()
    {
        $rules = require(dirname(__FILE__) . './../config/rules.php');
        $items = null;
        foreach ($rules as $rule) {
            $explodeArray = explode('/', $rule['controller']);
            $title = ucwords(str_replace('-', ' ', end($explodeArray)));
            $items[Yii::t('app', $title)] = '/' . $rule['controller'] . 's';
        }
        return $items;
    }
    public function actionTest(){
        $openId = Yii::$app->request->post("open_id");

        return ['code' => 0, 'message' =>$openId,'data'=>Yii::$app->user->id];
    }
}
